<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>get请求有参数</title>
  <script src="https://cdn.bootcdn.net/ajax/libs/qs/6.10.3/qs.js"></script>
  <script>
    // 创建实例对象
    var xhr=new XMLHttpRequest();
    let obj={
      page:1,
      pageSize:10
    };
    // 将obj转换为查询字符串 ?page=1&pageSize=10
    console.log(Qs.stringify(obj),'将obj对象转换为查询字符串');
    // 打开一个连接
    xhr.open('get','http://121.199.0.35:8888/index/article/pageQuery'+'?'+Qs.stringify(obj));
    // 发送请求
    xhr.send();
    // 接收响应
    xhr.onreadystatechange=function(){
      if(xhr.readyState===4&xhr.status===200){
        // response就是一个响应
        console.log(xhr.response);
      }
    }
  </script>
</head>
<body>
  
</body>
</html>